<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');   

    require_once ($application_folder."/libraries/MY_Controller.php"); 
    class Navigator extends MY_Controller {

        var $data = array();

        function __construct()
        {
            parent::__construct();
            $this->load->library('weather',array('loc' => 'MWXX0001'));                                       
            $this->weather->initialize();
            $this->myImage();
        }

        function index() { show_404(); }        

        function core_site($page=NULL,$data=NULL, $sub=NULL,$upsub=NULL){

            if ($data!=NULL){
                $this->data = array_merge((array)$this->data, (array)$data);   
            }

            $this->data['page'] = $page;
            $this->data['sub'] = $sub;
            $this->data['upsub'] = $upsub;
            $this->data['lang'] = $this->lang_ses->getlang();
            $this->data['path'] = base_url().'assets/';    
            $this->data['url'] = base_url();    

            $url;

            if(($sub=='')&&($upsub=='')){ 

                $url = $page;
                $this->asset->flag('page');

            }else if($upsub==''){ 

                    $url = $page.'/'.$sub;
                    $this->asset->flag('sub');

                }else{

                    $url = $page.'/'.$sub.'/'.$upsub;
                    $this->asset->flag('upsub');

            }

            $this->asset->layoutflag('site');

            $this->asset->initialze_assets($page, $sub, $upsub);

            if(!isset($this->data['title'])){
                $this->data['title'] = 'Title defined in Navigator';
            }

            $this->layout->view($url, $this->data);


        }

        function myImage(){

            $path = './';
            //Set images folder. (optional parameter)
            define("FOLDER_IMAGES",$path.'admin/tempatt/');

            //Set cache folder. (must parameter)
            define("FOLDER_CACHE",$path."cache/");    

            //Set jpeg quality 
            define("JPEG_QUALITY","90");

            //set image not found filepath. a must parameter. Output this image in case the image not found.
            define("FILEPATH_IMAGE_NOT_FOUND",$path."assets/images/blank.jpg");


            //--------------------------------------------------------------------

            $this->load->library('img_map');

            //set defines data
            $this->img_map->setImagesFolder(FOLDER_IMAGES);
            $this->img_map->setCacheFolder(FOLDER_CACHE);
            $this->img_map->setErrorImagePath(FILEPATH_IMAGE_NOT_FOUND);
            $this->img_map->setJpegQuality(JPEG_QUALITY); 

        }            

    }
?>